package com.lkx.web;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

public class DB {
	private static Map<String,Book> map = new LinkedHashMap();  
    
    //静态代码块中的内容只执行一次,该类在加载时，往map集合中put一系列书,map也需要设置为静态的  
    static{  
        System.out.println("运行了"+new Date().getMinutes()+"-"+new Date().getSeconds());
        map.put("1", new Book("1", "javaweb开发","老张", "一本好书"));  
        map.put("2", new Book("2", "spring开发","老倪", "一本好书"));  
        map.put("3", new Book("3", "hibernate开发","老童", "一本好书"));  
        map.put("4", new Book("4", "struts开发","老毕", "一本好书"));  
        map.put("5", new Book("5", "ajax开发","老张", "一本好书"));  
        map.put("6", new Book("6", "java基础","老孙", "一本好书"));  
          
    }  
      
    public static Map getAll() {  
        return map;  
    }     
}
